[Relax][TVMScript] Print ExternFunc struct_info when non-default#19416
Merged
tlopex merged 4 commits intoapache:mainfrom Apr 18, 2026
Merged
[Relax][TVMScript] Print ExternFunc struct_info when non-default#19416tlopex merged 4 commits intoapache:mainfrom
tlopex merged 4 commits intoapache:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances the Relax printer by introducing a helper function, HasDefaultExternFuncStructInfo, which allows the printer to conditionally omit structural information for external functions when they use the default inference function. This change results in cleaner and more concise printed output. Feedback was provided to optimize the new helper function by marking it as static and caching the global function lookup to avoid redundant registry queries during the printing process.
092a469 to
b8b10de
Compare
b8b10de to
ea93e01
Compare
Contributor
Author
tlopex
requested changes
Apr 18, 2026
Member
tlopex
left a comment
There was a problem hiding this comment.
Thanks! @cchung100m
- Should add test coverage in
tests/python/relax/test_tvmscript_printer_relax.py. At minimum, this should include:
- one case with non-default
struct_info(for example, withpurity=Trueor explicitparams/ret) - one round-trip test
- Maybe update the PR title from Unity to Relax, which I think is better
Contributor
Author
|
Hi @tlopex Thanks for the prompt reply and I have updated the part you mentioned. |
tlopex
approved these changes
Apr 18, 2026
Contributor
Author
|
Thanks to @tlopex 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add HasDefaultExternFuncStructInfo helper to detect default FuncStructInfo for extern functions.
Update relax::ExternFunc printer to: